home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tsptp.zip / STORE.PAS < prev    next >
Pascal/Delphi Source File  |  1993-04-09  |  3KB  |  91 lines

  1. (******************************************************************************)
  2. (*                                 STORE.PAS                                  *)
  3. (*                          File Handling Benchmark.                          *)
  4. (******************************************************************************)
  5.  
  6. PROGRAM Store(Output);
  7.  
  8. (******************************************************************************)
  9. (*                                TIMING                                      *)
  10. (******************************************************************************)
  11.  
  12. (*$IFNDEF TopSpeed *)
  13. (*%F TRUE   *** Compile for Turbo Pascal ***)
  14.   USES TPBench;
  15. (*%E*)
  16. (*$ELSE     *** Compile for TopSpeed Pascal ***)
  17.   IMPORT TSBench *;
  18. (*$ENDIF *)
  19.  
  20. (******************************************************************************)
  21.  
  22.   VAR
  23.     TestFile : Text;
  24.  
  25.   PROCEDURE FileStore;
  26.     VAR I : BmInt;
  27.   BEGIN
  28.  
  29.     Assign(TestFile,'TEST.DAT');
  30.     Rewrite(TestFile);
  31.  
  32.     FOR I := 1 TO 1000 DO
  33.     BEGIN
  34.       Write(TestFile,'1');
  35.       Write(TestFile,'2');
  36.       Write(TestFile,'3');
  37.       Write(TestFile,'4');
  38.       Write(TestFile,'5');
  39.       Write(TestFile,'6');
  40.       Write(TestFile,'7');
  41.       Write(TestFile,'8');
  42.       Write(TestFile,'9');
  43.       Write(TestFile,'0');
  44.       Write(TestFile,'q');
  45.       Write(TestFile,'w');
  46.       Write(TestFile,'e');
  47.       Write(TestFile,'r');
  48.       Write(TestFile,'t');
  49.       Write(TestFile,'y');
  50.       Write(TestFile,'u');
  51.       Write(TestFile,'i');
  52.       Write(TestFile,'o');
  53.       Write(TestFile,'p')
  54.     END;
  55.  
  56.     Close(TestFile);
  57.     Erase(TestFile);
  58.   END;
  59.  
  60. BEGIN
  61.   WriteLn('Store Benchmark');
  62.  
  63. (******************************************************************************)
  64. (*  Compute the looping overhead.  The Dummy procedure must have some side-   *)
  65. (*  effect so that it is not optimised out of existence.                      *)
  66. (******************************************************************************)
  67.  
  68.   StartTimer;                                   (* Start the clock.           *)
  69.  
  70.   REPEAT
  71.     Dummy;
  72.   UNTIL NullTimesUp;
  73.  
  74. (******************************************************************************)
  75. (*  Now run the benchmark.  Note that the Dummy procedure is also called so   *)
  76. (*  that we can eliminate its overhead from the looping overhead.             *)
  77. (******************************************************************************)
  78.  
  79.   StartTimer;                                   (* Start the clock.           *)
  80.  
  81.   REPEAT
  82.     FileStore;
  83.     Dummy
  84.   UNTIL BenchTimesUp;
  85.  
  86. (******************************************************************************)
  87.  
  88.   ReportTimes;
  89.  
  90. END.
  91.